** This do-file replicates the analysis in:

* Table 5, 
* Table A.4.
* Table C.1.
* Figure 2. 

 

clear
set matsize 2000
set more off
pause on

use replication-3.dta, replace


**** generating variable for the analysis 

tabulate week, gen(w)
tabulate treat, gen(t)


gen t1Xw1=t1*w1
gen t1Xw2=t1*w2

gen t2Xw1=t2*w1
gen t2Xw2=t2*w2

gen t3Xw1=t3*w1
gen t3Xw2=t3*w2


* standard deviation in evaluation ratings
egen sdcookie=rowsd(rat1-rat7)


* campus, leg and session fixed effects
egen fe_cls = concat(campus leg week)

* cookieXcampusXlegXsession fixed effects
gen cookieidX1000=cookieid*1000
egen fe_cookiecls=concat(cookieidX1000 fe_cls)


* id X week fixed effects
gen temp=9999
egen idweek=concat(id temp week)

**** 

keep if cookie3t==1

********************************************************************************************
****** Table 5 *******************


** WEEK 1

*Unadjusted
reg sdcookie   t1Xw2 t2Xw1 t2Xw2 t3Xw1 t3Xw2  ,  cluster(id)


* with cookie, campus, leg and session fixed effects
areg sdcookie   t1Xw2 t2Xw1 t2Xw2 t3Xw1 t3Xw2 , absorb(fe_cookiecls) cluster(id)



** WEEK 2
*Unadjusted
reg sdcookie   t1Xw1 t2Xw1 t2Xw2 t3Xw1 t3Xw2 ,  cluster(id)


* with cookie, campus, leg and session fixed effects
areg sdcookie   t1Xw1 t2Xw1 t2Xw2 t3Xw1 t3Xw2, absorb(fe_cookiecls) cluster(id)


**********************************************************************************************
**** Figure 2 


*** CDFs FOR PAPER
distplot sdcookie if week==1 & (treat==1| treat==2 | treat==3), recast(line)  ///
title ("Session One (Reward)") legend(order(1 "Control" 2 "Unanticipated" 3 "Anticipated")) ///
ytitle("Cumulative Probability") xtitle("Standard Deviation of Ratings per Evaluation")  over(treat) xsize(20)  ysize(15) scheme(s2manual)

graph save sd-w1, replace

distplot sdcookie if week==2 & (treat==1| treat==2 | treat==3), recast(line) ///
title ("Session Two (Non-Reward)") legend(order(1 "Control" 2 "Unanticipated" 3 "Anticipated")) ///
ytitle("") xtitle("Standard Deviation of Ratings per Evaluation")  over(treat) xsize(20)  ysize(15) scheme(s2manual)

graph save sd-w2, replace 

**** Combine the two graphs above

graph combine sd-w1.gph sd-w2.gph , xcommon ycommon xsize(7)





********************* Appendix Tables and Figures *******************
***** Table A.4. ******* 


*** Week 1 - evaluations fixed effects
areg evaluations   t1Xw2 t2Xw1 t2Xw2 t3Xw1 t3Xw2   if  single_3t==1,  absorb(fe_cls) cluster(id)


*** Week 2 -- evaluations fixed effects
areg evaluations   t1Xw1 t2Xw1 t2Xw2 t3Xw1 t3Xw2   if  single_3t==1,  absorb(fe_cls) cluster(id)


********* MINUTES PER EVALUATION

*** Week 1 - minutes per evaluation fixed effects

areg mineval   t1Xw2 t2Xw1 t2Xw2 t3Xw1 t3Xw2   if  single_3t==1,  absorb( fe_cls) cluster(id)


*** Week 2 - - minutes per evaluation fixed effects

areg mineval   t1Xw1 t2Xw1 t2Xw2 t3Xw1 t3Xw2   if  single_3t==1,  absorb( fe_cls) cluster(id)





********************************** TABLE C.1. ***********************************
** TABLE C.1. *****

tab cookieor, gen(cookieor)
tab idweek, gen(idweek)

su tc1


*
reg sdcookie tc1, cluster(id)


*
areg sdcookie tc1 , absorb(id) cluster(id)


*
areg sdcookie tc1 cookieor1-cookieor70 , absorb(id) cluster(id)

*
areg sdcookie tc1  cookieor1-cookieor70 , absorb(idweek) cluster(id)

*
xi: reg sdcookie tc1  i.cookieor i.idweek i.fe_cookiecls, cluster(id)

